import { request } from "@umijs/max";
import qs from "qs";

// 查询用户的聊天室列表
export const chatRoomList = (params:Record<string, any>, options?:Record<string, any>) => {
    return request('http://localhost:8080/openapi/chatroom/list', {
        method: 'POST',
        headers: {
            "content-type": "application/x-www-form-urlencoded",
        },
        data: qs.stringify(params),
        ...options,
    });
}

// 添加聊天室
export const chatRoomAdd = (params:Record<string, any>, options?:Record<string, any>) => {
    return request('http://localhost:8080/openapi/chatroom/add', {
        method: 'POST',
        headers: {
            "content-type": "application/x-www-form-urlencoded",
        },
        data: qs.stringify(params),
        ...options,
    });
}

// 修改聊天室
export const chatRoomUpdate = (params:Record<string, any>, options?:Record<string, any>) => {
    return request('http://localhost:8080/openapi/chatroom/update', {
        method: 'POST',
        headers: {
            "content-type": "application/x-www-form-urlencoded",
        },
        data: qs.stringify(params),
        ...options,
    });
}

// 删除聊天室
export const chatRoomDel = (params:Record<string, any>, options?:Record<string, any>) => {
    return request('http://localhost:8080/openapi/chatroom/delete', {
        method: 'POST',
        headers: {
            "content-type": "application/x-www-form-urlencoded",
        },
        data: qs.stringify(params),
        ...options,
    });
}
